package com.caoxw.Android.CityBus;

import java.util.ArrayList;

public final class LinesStruct {
	public  ArrayList<ChangeBus> m_CBS = new ArrayList<ChangeBus>();
	public void Add(ChangeBus CBS){
		if(m_CBS.size()==0 || m_CBS.get(m_CBS.size()-1).TotalStations < CBS.TotalStations) 
		{
			m_CBS.add(CBS);
			return ;
		}
		if(CBS.TotalStations<=m_CBS.get(0).TotalStations)
		{
			m_CBS.add(0, CBS);
			return;
		}

		for(int i=0;i< m_CBS.size()-1;i++)
		{
			if((CBS.TotalStations>=m_CBS.get(i).TotalStations) 
				&& (CBS.TotalStations<m_CBS.get(i+1).TotalStations))
			{
				m_CBS.add(i+1,CBS);
				return;
			}
		}
		m_CBS.add(CBS);
		
	}
	public boolean isEmpty(){
		return (m_CBS.size()==0);
	}
	public int	size(){
		return m_CBS.size();
	}
	
	public ChangeBus get(int index){
		return m_CBS.get(index);
	}

}
